package com.wxapp.admin.service.controller;

import com.wxapp.admin.api.pojo.vm.role.PRoleDetailVm;
import com.wxapp.common.constant.base.IBaseController;
import com.wxapp.common.constant.pojo.vm.ResultVm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
@Tag(name = "测试")
@RequiredArgsConstructor
public class TestController extends IBaseController {
    private final RocketMQTemplate  rocketMQTemplate;

    @GetMapping("/sendMsg")
    @Operation(summary = "发送消息")
    public ResultVm<PRoleDetailVm> detailRole() {
        //发送消息，需要关注发送结果，并捕获失败等异常。
        rocketMQTemplate.convertAndSend("RLT_TEST_TOPIC","Hello,RocketMQ");
        return success();
    }

}
